package com.my.job;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Scarlett on 2018/8/14 0014.
 */
public class Key {
    private String name;

    public Key(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        return 1;
    }


    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override
    public String toString() {
        return this.name;
    }

    public static void main(String[] args) throws Exception {
        Map<Key, Key> map = new HashMap<>();

        Key key1 = new Key("key 1");
        map.put(key1, key1);

        Key key2 = new Key("key 2");
        map.put(key2, key2);

        for (Map.Entry<Key, Key> entry : map.entrySet()) {
            System.out.println(entry.getKey());
        }
    }
}
